package com.firefoxking.mysite.controller.test;

import com.firefoxking.mysite.utils.Commons;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class IndexController {

//    @RequestMapping(path = {"/", "/index"})
//    public String getIndexPage(Model model) {
//        model.addAttribute("commons", commons);
//        return "/site/index";
//    }

    @RequestMapping(path = "/head")
    public String getHeadPage(Model model) {
        return "site/head";
    }

    @RequestMapping(path = "header")
    public String getHeaderPage(Model model) {
        return "site/header";
    }

    @GetMapping("/registertest")
    public String getRegisterPage() {
        return "test/requestparam-test";
    }

    @PostMapping("/registertest")
    public String postRegisterPage(@RequestParam("username") String userName) {
        System.out.println(userName);
        return "test/requestparam-test";
    }
}
